package org.itboys.mobile.service.mongo.web.dynamic;

import org.itboys.mobile.common.SundayCommonConstants;
import org.itboys.mobile.entity.mongo.dynamic.SundayDynamicProduct;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseMongoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 作者：jiangxiong
 * 日期：2017年4月26日
 * 联系方式 ：empty90911@126.com
 * 描述：圣代_移动端（通用）_动态_产品_sevice。如果属性不够，请自行填充
 */
@Service
public class SundayDynamicProductService extends BaseMongoService<SundayDynamicProduct>{

    @Resource(name = "mobileDs")
    private MongoDataSource sundayDataSource;
    @Override
    protected MongoDataSource getMongoDataSource() {
        return sundayDataSource;
    }

    @Override
    protected Class<SundayDynamicProduct> getEntityClass() {
        return SundayDynamicProduct.class;
    }

    /**
     * 不分页查询动态商品
     * @param dynamicId
     * @return
     */
    public List<SundayDynamicProduct> selectProduct(Long dynamicId){
        Map<String,Object> param = new HashMap<String,Object>();
        param.put("isDeleted", SundayCommonConstants.NO);
        param.put("dynamicId",dynamicId);
        return super.list(param);
    }

}
